<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">

        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
                <!--                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>-->
            </h:panelGroup>
            <h:form prependId="false">
                <p:panel toggleable="true" id="salesLeadEdit" header="Edit Vendor Details">
                    <h:panelGrid columns="3">

                     

                        <h:outputLabel value="Title: " for="title" />
                        <h:selectOneMenu id="title" value="#{vendorEntityController.selectedVendor.title}"  >
                            <f:selectItems value="#{systemUserEntityController.userTitles}"/>
                        </h:selectOneMenu>
                        <h:message styleClass="errorMsg" for= "title"/>

                        <h:outputLabel value="FirstName: " for="firstName" />
                        <p:inputText id="firstName" value="#{vendorEntityController.selectedVendor.firstName}" />
                        <h:message styleClass="errorMsg" for= "firstName"/>

                        <h:outputLabel value="LastName: " for="lastName" />
                        <p:inputText id="lastName" value="#{vendorEntityController.selectedVendor.lastName}"   />
                        <h:message styleClass="errorMsg" for= "lastName"/>


                        <h:outputLabel value="Company Name: " for="companyName" />
                        <p:inputText id="companyName" value="#{salesLeadEntityController.selected.companyName}"/>
                        <h:message styleClass="errorMsg" for= "companyName"/>

                        <h:outputLabel value="Job Title: " for="jobTitle" />
                        <p:inputText id="jobTitle" value="#{vendorEntityController.selectedVendor.jobTitle}" />
                        <h:message styleClass="errorMsg" for= "jobTitle"/>


                    </h:panelGrid>
                </p:panel>
                <br/>
                <p:panel toggleable="true" id="salesLeadContact" header="Contact Details">
                    <h:panelGrid columns="3">
                        <h:outputLabel value="Contact Number: " for="contactNumber" />
                        <p:inputText id="contactNumber" value="#{vendorEntityController.selectedVendor.contact.contactNumber}"  >
                        </p:inputText>
                        <h:message styleClass="errorMsg" for= "contactNumber"/>

                        <h:outputLabel value="Email: " for="email" />
                        <p:inputText  id="email" value="#{vendorEntityController.selectedVendor.contact.email}"  >
                        </p:inputText>
                        <h:message styleClass="errorMsg" for= "email" />
                    </h:panelGrid>    
                </p:panel>
                <br />
                <p:panel header="Vendor Address: " style="text-align: center" >
                    <h:panelGrid columns="2" style="width: 100%;"> 
                        
                        <p:panel header="Office Addrress:" toggleable="true" style="width:100">
                            <h:panelGrid columns="2" style="width: 100%;" > 
                             
                                <h:outputText value="Street Address:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.address.streetAddress}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                             
                               
                                <h:outputText value="City:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.address.city}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                            
                            
                                <h:outputText value="StateOrProvince:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.address.stateOrProvice}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                              
                              
                                <h:outputText value="Country:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.address.country}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                               
                                
                                <h:outputText value="Zip code:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.address.zipCode}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                              
                             
                            </h:panelGrid> 
                        </p:panel >
                     
                        <p:panel header="Billing Addrress:" toggleable="true"  >
                            <h:panelGrid columns="2" style="width: 100%;"> 
                             
                                <h:outputText value="Street Address:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.addresse.streetAddress}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                           
                               
                                <h:outputText value="City:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.addresse.city}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                          
                                
                                <h:outputText value="StateOrProvince:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.addresse.stateOrProvice}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                                 

                               <h:outputText value="Country:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.addresse.country}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                               
                                <h:outputText value="Zip Code:"/>
                                <p:inplace editor="true" >       
                                    <p:inputText value="#{vendorEntityController.addresse.zipCode}" 
                                                 required="true" label="text"/>  
                                </p:inplace> 
                          
                               
                            </h:panelGrid>
                        </p:panel>
                               
                    </h:panelGrid>
                </p:panel>
    <p:separator />  
                <br />
                
          <p:fieldset legend="Raw Material Provided:" toggleable="true" toggleSpeed="500"  
              
           >       
 <p:dataTable  value="#{vendorEntityController.rms}" var="ven" widgetVar="userTable"
                                  paginator="true" rows="10"  
                          >
                                  

                        <p:column sortBy="#{ven.productName}" filterBy="#{ven.productName}">    <f:facet name="header">  
                                <h:outputText value="Current Raw Material of this vendor " /> </f:facet>
                            <h:outputText value="#{ven.productName}" /> </p:column>


          
                    </p:dataTable> 
<p:separator style="width:200px;height:20px" />   
                <p:pickList value="#{vendorEntityController.rmsPickList}"  
                             var="item"  
                            itemLabel="#{item}"  
                            itemValue="#{item}">
                    <f:facet name="sourceCaption">All Raw Materials List</f:facet>  
                    <f:facet name="targetCaption">Final Raw Materials List </f:facet>
                </p:pickList>
  
  </p:fieldset>  
             <p:separator />  
             <br/>
 
                <p:commandButton ajax="false" action="#{vendorEntityController.update1}" value="Save" update ="growl"/>
 <p:commandButton ajax="false" action="ListSupplier" value="Back" />

            </h:form>

        </ui:define>
    </ui:composition>

</html>
